package java1;


import java.sql.SQLOutput;

public class PrimeNumber {
    public static void main(String [] args) {
        int count = 0;
        boolean flag = true;
        System.out.println("找100以内的质数：");
        for (int i = 2; i <= 100; i++) {
            for (int j = 2; j < i; j++) {
                if (i % j == 0) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.print(i + " ");
                count++;
                if (count % 5 == 0) {
                    System.out.println();
                }
            }
            flag = true;
        }

        System.out.println("找100个质数：");
        int count1 = 0;
        boolean flag1 = true;
            for (int m = 2;count1 < 100;m++){
                for(int n = 2;n < m;n++){
                    if(m % n == 0){
                        flag1 = false;
                        break;
                    }
                }
                if (flag1){
                    System.out.print(m + "  ");
                    count1++;
                    if (count1 % 5 == 0){
                        System.out.println();
                    }
                }
                flag1 = true;
            }



    }
}
